Make resetting a filter work properly
authorMatthias Clasen <mclasen@redhat.com>
Tue, 1 Oct 2013 01:57:41 +0000 (21:57 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 7 Oct 2013 03:31:18 +0000 (23:31 -0400)
We need to make sure all children are marked as child-visible
again when the filter func is reset.

gtk/gtkflowbox.c

index 9f3876080024dbaba6f59e704be5d4db8e3cfe2c..a0f1f7e9dd17279d51187d4782e2b04b9265b50f 100644 (file)
@@ -926,6 +926,23 @@ gtk_flow_box_apply_filter (GtkFlowBox      *box,
   gtk_widget_set_child_visible (GTK_WIDGET (child), do_show);
 }
 
+static void
+gtk_flow_box_apply_filter_all (GtkFlowBox *box)
+{
+  GSequenceIter *iter;
+
+  for (iter = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
+       !g_sequence_iter_is_end (iter);
+       iter = g_sequence_iter_next (iter))
+    {
+      GtkFlowBoxChild *child;
+
+      child = g_sequence_get (iter);
+      gtk_flow_box_apply_filter (box, child);
+    }
+  gtk_widget_queue_resize (GTK_WIDGET (box));
+}
+
 static void
 gtk_flow_box_apply_sort (GtkFlowBox      *box,
                          GtkFlowBoxChild *child)
@@ -4582,7 +4599,7 @@ gtk_flow_box_set_filter_func (GtkFlowBox           *box,
   priv->filter_data = user_data;
   priv->filter_destroy = destroy;
 
-  gtk_flow_box_invalidate_filter (box);
+  gtk_flow_box_apply_filter_all (box);
 }
 
 /**
@@ -4605,20 +4622,7 @@ gtk_flow_box_invalidate_filter (GtkFlowBox *box)
   g_return_if_fail (GTK_IS_FLOW_BOX (box));
 
   if (BOX_PRIV (box)->filter_func != NULL)
-    {
-      GSequenceIter *iter;
-
-      for (iter = g_sequence_get_begin_iter (BOX_PRIV (box)->children);
-           !g_sequence_iter_is_end (iter);
-           iter = g_sequence_iter_next (iter))
-        {
-          GtkFlowBoxChild *child;
-
-          child = g_sequence_get (iter);
-          gtk_flow_box_apply_filter (box, child);
-        }
-      gtk_widget_queue_resize (GTK_WIDGET (box));
-    }
+    gtk_flow_box_apply_filter_all (box);
 }
 
 /* Sorting {{{2 */